
//-------------------------------------------
const int ledPin = 13;       // the pin that the LED is attached to

const byte buttonPin = 8;
int buttonState;
int buttonLastState;

int lightPin = 9;

//-------------------------------------------
void setup() {

  //--led
  pinMode(ledPin, OUTPUT);
  
  //--light
  pinMode(lightPin, OUTPUT);

  //--pins
  pinMode( buttonPin, INPUT);
  buttonState = -1;
  buttonLastState = -1;

  //--serial
  Serial.begin(9600);
  Serial.println("---setup---");

}

//-------------------------------------------
void loop() {

  //--button
  buttonState = digitalRead( buttonPin );

  if (buttonState != buttonLastState ) {

    if (buttonState == HIGH) {
      Serial.println("b1");
      digitalWrite(lightPin, LOW);
      delay(100);
      digitalWrite(lightPin, HIGH);
      delay(100);
      digitalWrite(lightPin, LOW);
      delay(100);
      digitalWrite(lightPin, HIGH);
      delay(100);
      digitalWrite(lightPin, LOW);
      delay(100);      
      digitalWrite(lightPin, HIGH);
      delay(100);
      digitalWrite(lightPin, LOW);
      delay(100);     
      digitalWrite(lightPin, HIGH);
      delay(100);
      digitalWrite(lightPin, LOW);
      delay(100);     
    } 
    else {
      Serial.println("b0");
      digitalWrite(lightPin, HIGH);
      delay(100);
    }

    buttonLastState = buttonState;
  }
  

}











